package com.aabte.design2.behavioral.templatemethod;

/**
 * @author Daniel
 * @version 1.0
 * @date 2020/5/4
 */
public abstract class GameAI {

    /**
     * 模板方法定义了某个算法的框架
     * 子类不能重写模板方法
     */
    public final void turn() {
        collectResources();
        buildStructures();
        buildUnits();
        attack();
    }

    protected void collectResources() {
        System.out.println("GameAI#collectResources");
    }

    protected abstract void buildStructures();

    protected abstract void buildUnits();

    protected void attack() {
        System.out.println("GameAI#attack");
    }

}
